package com.ccreservoirs.service.impl;

import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cache.annotation.Caching;
import org.springframework.stereotype.Service;

import com.ccreservoirs.service.HelloService;

@Service
public class HelloServiceImpl implements HelloService {

	@Override
	@Cacheable(value = "name", key = "#id")
	public String getName(String id) {
		System.out.println("1234");
		return "1234";
	}

	@Cacheable(value = "list")
	public String getIds() {
		System.out.println("1234");
		return "1234";
	}

	@Override
	@Caching(evict = { @CacheEvict(value = "name", key = "#result", condition = "#result!=null"),
			@CacheEvict(value = "list", allEntries = true) })
	public String removeName() {
		System.out.println("2341");
		return "123";
	}

}
